package cn.elricyu.tt.action;

import net.sf.json.JSON;
import cn.elricyu.tt.action.base.AbstractAction;
import cn.elricyu.tt.bean.ServerTime;
import cn.elricyu.tt.bean.User;
import cn.elricyu.tt.util.JsonUtil;

public class ServerTimeAction extends AbstractAction<Long> {

	public ServerTimeAction(User self, boolean showTip) {
		this.url = "root/server!getServerTime.action";
	}

	public void process(JSON json) {
		try {
			long time = JsonUtil.getLongValue(json, "time", 0);
			long current = System.currentTimeMillis();
			if (time > 0) {
				ServerTime.PLUS = time - current;
			}
		} catch (Exception e) {
		}
	}

}
